import * as mainActions from '../actions/main'
import defaultState from "../state";

const mainReducer = (state = defaultState,action) => {
    let s = JSON.parse(JSON.stringify(state));
    switch(action.type){
        case mainActions.ADD :
            if (action.defultNumber){
                s.count = action.defultNumber
            }else {
                s.count++
            }
            break;
        case mainActions.JIAN :
            s.count --
            break;
    }
    return s
}

export default mainReducer